/*
 * Copyright (C) 2023 xuexiangjys(xuexiangjys@163.com)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

package com.xuexiang.templateproject.adapter;
import static com.xuexiang.xutil.resource.ResUtils.getColor;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.Resources;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.umeng.analytics.pro.d;
import com.xuexiang.templateproject.utils.DisplayUtil;
import com.zhy.view.flowlayout.FlowLayout;
//import org.jetbrains.anko.Sdk27PropertiesKt;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;
import com.xuexiang.templateproject.R;
import com.zhy.view.flowlayout.TagAdapter;


public class SetAnswerAdapter extends TagAdapter<String> {

    /* renamed from: d  reason: collision with root package name */
    public Context f14538d;

    /* renamed from: e  reason: collision with root package name */
    public int f14539e;

    /* renamed from: f  reason: collision with root package name */
    public float f14540f;

    /* renamed from: g  reason: collision with root package name */
    public float f14541g;

    /* renamed from: h  reason: collision with root package name */
    public int f14542h;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public SetAnswerAdapter(@NotNull List<String> list, @NotNull Context context, int i2, float f2, float f3, int i3) {
        super(list);
//        Intrinsics.checkNotNullParameter(list, "list");
//        Intrinsics.checkNotNullParameter(context, "context");
        this.f14538d = context;
        this.f14539e = i2;
        this.f14540f = f2;
        this.f14541g = f3;
        this.f14542h = i3;
    }

    @Override // d.z.a.a.a
    @SuppressLint({"UseCompatLoadingForDrawables"})
    public void onSelected(int i2, @Nullable View view) {
        super.onSelected(i2, view);
//        Intrinsics.checkNotNull(view, "null cannot be cast to non-null type android.widget.TextView");
        TextView textView = (TextView) view;
        Context context = this.f14538d;
        Resources resources = null;
        Resources resources2 = context != null ? context.getResources() : null;
//        Intrinsics.checkNotNull(resources2);
        textView.setBackground(resources2.getDrawable(R.drawable.bg_blue_corner));
        Context context2 = this.f14538d;
        if (context2 != null) {
            resources = context2.getResources();
        }
//        Intrinsics.checkNotNull(resources);
//        Sdk27PropertiesKt.setTextColor(textView, resources.getColor(R.color.white));
        textView.setTextColor(getColor(R.color.white));
    }

    @Override // d.z.a.a.a
    @SuppressLint({"UseCompatLoadingForDrawables"})
    public void unSelected(int i2, @Nullable View view) {
        super.unSelected(i2, view);
//        Intrinsics.checkNotNull(view, "null cannot be cast to non-null type android.widget.TextView");
        TextView textView = (TextView) view;
        Context context = this.f14538d;
        Resources resources = null;
        Resources resources2 = context != null ? context.getResources() : null;
//        Intrinsics.checkNotNull(resources2);
        textView.setBackground(resources2.getDrawable(this.f14542h));
        Context context2 = this.f14538d;
        if (context2 != null) {
            resources = context2.getResources();
        }
//        Intrinsics.checkNotNull(resources);
//        Sdk27PropertiesKt.setTextColor(textView, resources.getColor(R.color.common_theme_black));
        textView.setTextColor(getColor(R.color.common_theme_black));
    }

    @NotNull
    /* renamed from: k */
    public View getView(@Nullable FlowLayout flowLayout, int i2, @Nullable String str) {
        View inflate = LayoutInflater.from(this.f14538d).inflate(this.f14539e, (ViewGroup) null);
//        Intrinsics.checkNotNullExpressionValue(inflate, "from(mContext)\n            .inflate(mLayout, null)");
        View findViewById = inflate.findViewById(R.id.tvName);
//        Intrinsics.checkNotNullExpressionValue(findViewById, "view.findViewById(R.id.tvName)");
        TextView textView = (TextView) findViewById;
        textView.setMinWidth(DisplayUtil.dip2px(this.f14538d, this.f14540f));
        textView.setHeight(DisplayUtil.dip2px(this.f14538d, this.f14541g));
        textView.setText(str);
        return inflate;
    }
}
